﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;

public class AbilityManager:PersistentSingleton<AbilityManager>
{
    private FactoryManger<Ability, AbilityData> abilityFactory;
    protected override void Awake()
    {
        base.Awake();

        abilityFactory=new FactoryManger<Ability, AbilityData>();
        abilityFactory.LoadJson("Data/abilityData.json");
    }
    public Ability GetAbility(int id)
    {
        Ability ability= abilityFactory.GetInstance(id);
        if (ability != null )
        {
            return ability;
        }
        return null;
    }
    public Ability GetAbility(string name)
    {
        Ability ability = abilityFactory.GetInstance(name);
        if (ability != null)
        {
            return ability;
        }
        return null;
    }
}

